package com.blb.demo2;

import com.blb.Computer;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author lvtian
 * @date 2022/12/22 14:21
 */
public class ComputerSpringXml {
    public static void main(String[] args) {
        //类路径
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
        //从容器中获得对象
//        Computer computer= (Computer) context.getBean("computer");
        Computer computer = context.getBean                                                                                                                                                                               (Computer.class);
        computer.start();
        System.out.println(computer);
    }
}
